package com.thread.threadPool;

/**
 * @author butterflyace
 * @date 2020/3/24 23:32
 * @remark
 */
public class TestDemo {


    public static void main(String[] args) {
        Student student = new Student();
        student.setName("为开始");

        new Thread(()->{
            student.setName("t1");
            student.setId(1L);
            System.out.println(student.toString());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        new Thread(()->{
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            student.setName("t2");
            System.out.println(student.getId());
        }).start();

    }


    public static class Student{
        private String name;

        private Long id = 0L;

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}
